<?php

namespace App\Http\Controllers;

use Tymon\JWTAuth\JWTAuth;
use Illuminate\Http\Request;

class ExampleController extends Controller
{
    protected $jwt;

    /**
     * Create a new controller instance.
     *
     * @return void
     */
    public function __construct(JWTAuth $jwt)
    {
        $this->jwt = $jwt;
    }
    
    // 获取用户信息
    public function getUser(Request $request) {
        return response()->json(['user' => $this->jwt->user()]);
    }
}
